﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class teacher : System.Web.UI.Page
{
    db_course course = new db_course();
    public string teachName = "";
    public string teachAbout = "";
    public string teachID = "";
    public string picUrl="";
    public string strcr = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["id"] == null)
        {
            Response.Redirect("index.aspx");
        }
        db_blogroll blogroll = new db_blogroll();
        DataSet ds_blogroll = blogroll.selectBlogrollALL();
        blogrollList.DataSource = ds_blogroll.Tables[0].DefaultView;
        blogrollList.DataBind();

        db_copyright cr = new db_copyright();
        DataSet dscr = cr.selectOne();
        strcr = "Copyright &copy; " + dscr.Tables[0].Rows[0]["cryear"].ToString() + " " + dscr.Tables[0].Rows[0]["owner"].ToString() + " ALL Rights Reserved<br/><a href=\"http://www.miibeian.gov.cn\" target=\"_blank\">" + dscr.Tables[0].Rows[0]["approve"].ToString() + "</a>";

        db_teacher teach = new db_teacher();
        DataSet hit = new DataSet();
        hit = teach.selectTeacherHit_Top("8");
        hit_list.DataSource = hit.Tables[0].DefaultView;
        hit_list.DataBind();

        hit = new db_course().selectCourseSellTop("8");
        all_hit_list.DataSource = hit.Tables[0].DefaultView;
        all_hit_list.DataBind();

        DataSet ds = new DataSet();
        teachID = Request.QueryString["id"];
        ds = teach.selectTeacherONE(teachID);
        if (ds.Tables[0].Rows.Count == 0 )
        {
            Response.Write("<script language=javascript>alert('找不到数据！');</script>");
            Response.End();
        }
        else
        {
            teachName = ds.Tables[0].Rows[0]["teacherName"].ToString();
            this.Page.Title = teachName + "_教师信息 - 三剑客在线教育系统";
            teachAbout = ds.Tables[0].Rows[0]["about"].ToString();
            picUrl = ds.Tables[0].Rows[0]["picUrl"].ToString();
            ds = course.selectCourseByTeacherId(teachID);
            courseList.DataSource = ds.Tables[0].DefaultView;
            courseList.DataBind();
        }
    }
}